
define(['config/appregister'],function(app){
    app.directive("date3",function(){
        return {
            templateUrl:"app/business/Companyinfor/directive/template/date3.html",
            link:function(scope,element,attrs){
                var date = new Date();
                var seperator1 = "-";
                var year = date.getFullYear();
                var month = date.getMonth() + 1;
                var strDate = date.getDate();
                if (month >= 1 && month <= 9) {
                    month = "0" + month;
                }
                if (strDate >= 0 && strDate <= 9) {
                    strDate = "0" + strDate;
                }
                var oldMonth = month - 3;
                var oldYear = year;
                if(oldMonth <= 0){
                    oldMonth += 12;
                    oldYear -= 1;
                }
                var currentdate = year + seperator1 + month + seperator1 + strDate;
                var oldDate = oldYear + seperator1 + oldMonth + seperator1 + strDate;
                var dateRange1 = new pickerDateRange('date3', {
                    isTodayValid : true,
                    startDate : currentdate,
                    endDate : currentdate,
                    needCompare : false,
                    defaultText : ' 至 ',
                    dayRangMax:'90',
                    inputTrigger : 'input_trigger13',
                    theme : 'ta',
                    success : function(obj) {
                        $("#dCon2").html('开始时间 : ' + obj.startDate + '<br/>结束时间 : ' + obj.endDate);
                        scope.$emit('chooseDate', obj.startDate,obj.endDate);
                    }
                });


            }
        }
    });
});

